/* ----------------------------------------------------------------------------------------------------------------------------------------------- /

MapManger - 类名称
修改许可权限 - 江利峰

< --- Public Vars ------------------------------------------------------------------------------------------------------------------------------ >

< --- Public Functions ------------------------------------------------------------------------------------------------------------------------ >

※ 构造函数
public function MapManger()

/ ----------------------------------------------------------------------------------------------------------------------------------------------- */
package editor.manager{
	import editor.common.Common;
	import editor.map.BackgroundLayer;
	import editor.map.GMap;
	import editor.map.NpcLayer;
	import editor.map.TileLayer;
	
	import flash.display.DisplayObjectContainer;
	import flash.events.Event;
	import flash.filesystem.File;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	import mx.core.Singleton;

	public class MapManger{
		
		private static var __instance:MapManger;
		
		public var tileLayer:TileLayer;
		public var backgroundLayer:BackgroundLayer;
		public var npcLayer:NpcLayer;
		public var gmap:GMap;
		
		private var _container:DisplayObjectContainer;
		
		public static function getInstance():MapManger
		{
			if(__instance == null)
				__instance = new MapManger(new Singleton());
			return __instance;
		}
		
		// 构造函数
		public function MapManger(s:Singleton)
		{
//			loadWordXml();
		}
		
		// 加载总xml文件
		private function loadWordXml():void
		{
			var loader:URLLoader = new URLLoader();
			loader.addEventListener(Event.COMPLETE, onWorldXmlOk);
			loader.load(new URLRequest("assets/worldMap.xml"));	
		}
		
		private function onWorldXmlOk(evt:Event):void
		{
			Common.worldXml = new XML(evt.target.data);
		}
		
		
		public function updateBackgroundImage(file:File):void
		{
			backgroundLayer.changeBackground(file);
		}
		//
	}
}

class Singleton
{}